package com.zyy.game.tianlong.network;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;

/**
 *  以16进制格式化输出传输内容
 * @author relufi
 * @date 2019/7/27 0027
 */
@Slf4j
@ChannelHandler.Sharable
public class ShowHexDump extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        log.debug("\n" + ByteBufUtil.prettyHexDump((ByteBuf) msg));
        super.channelRead(ctx, msg);
    }
}
